<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:util="http://java.sun.com/jsf/composite/components/util"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:p="http://primefaces.prime.com.tr/ui" 
                xmlns:f="http://java.sun.com/jsf/core">

    <div id="conversationsList">
        <h:form id="conversationsForm">
            <p:dataTable id="conversationsTable"
                var="conversation" value="#{conversationControllerBean.conversations}"
                paginator="true" rows="10" selection="#{conversationBackingBean.selectedConversation}"
                selectionMode="single"  paginatorAlwaysVisible="false"
                rowSelectListener="#{conversationBackingBean.navigate}"
                update="clientid">

                <p:column id="conversationsUser" sortBy="#{conversationControllerBean.getOtherUser(conversation)}">
                <f:facet name="header">
                    <h:outputText value="#{msg.searchResultsUsername}" />
                </f:facet>
                <h:graphicImage id="searchResImage" url="#{conversationControllerBean.getOtherUser(conversation).profilePic}"/>
                <h:outputText value="#{conversationControllerBean.getOtherUser(conversation)}" />
            </p:column>
            
           <p:column>
               <f:facet name="header">
                   <h:outputText value="#{msg.lastMessageLabel}" />
               </f:facet>
                   <h:outputText value="#{conversationControllerBean.getFirstMessage(conversation).content}" />
           </p:column>
		   
           <p:column>
               <f:facet name="header">
                   <h:outputText value="#{msg.unreadMessages}" />
               </f:facet>
                   <h:outputText value="#{conversationControllerBean.unreadMessages(conversation)}" />
           </p:column>
            
        </p:dataTable>
            
        </h:form>
    </div>
</ui:composition>   